Skip to content

ci: store Windows Defender scan logs as artifact on cross-platform build#39726

Merged
pelikhan merged 3 commits into
mainfrom
copilot/make-windows-tests-more-reliable
Jun 17, 2026
Merged

ci: store Windows Defender scan logs as artifact on cross-platform build#39726
pelikhan merged 3 commits into
mainfrom
copilot/make-windows-tests-more-reliable

Conversation

Copilot AI commented Jun 17, 2026

Copy link
Copy Markdown
Contributor

Intermittent failures in the Build & Test on windows-latest job (e.g. run 27662036462) are hard to diagnose because the Defender scan diagnostic output is only available in the ephemeral job log.

Changes

  • Log file: At the end of the Scan built binary with Microsoft Defender step, writes a structured log to $RUNNER_TEMP/defender-scan-log.txt containing Defender status/preferences, binary hashes, and full MpCmdRun.exe output. Write is wrapped in try-catch so a logging failure cannot cause the scan step to fail.
  • Artifact upload: New Upload Defender scan logs step (if: always() && runner.os == 'Windows') uploads the log file as defender-scan-log-<run_id>-<attempt>, retained for 7 days — persisted even when the scan step fails.

Copilot AI and others added 3 commits June 17, 2026 03:05
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
…n try-catch

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
@pelikhan pelikhan marked this pull request as ready for review June 17, 2026 03:43
Copilot AI review requested due to automatic review settings June 17, 2026 03:43
@pelikhan pelikhan merged commit 158af72 into main Jun 17, 2026
1 check passed
@pelikhan pelikhan deleted the copilot/make-windows-tests-more-reliable branch June 17, 2026 03:45

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR improves diagnosability of intermittent Windows Microsoft Defender scan failures in the cross-platform-build job by persisting Defender diagnostics and scan output as a workflow artifact, so the data survives beyond the ephemeral job log.

Changes:

  • Emit a Defender diagnostics + MpCmdRun.exe output log to $RUNNER_TEMP/defender-scan-log.txt at the end of the scan step.
  • Upload the log as a retained Actions artifact on Windows runs (if: always() && runner.os == 'Windows').
  • (Unrelated) Tighten validation for update_release.body in release.lock.yml by adding a minLength constraint.
Show a summary per file
File Description
.github/workflows/cgo.yml Adds Defender scan log generation and uploads the log as an artifact on Windows runs.
.github/workflows/release.lock.yml Introduces a minLength validation constraint for update_release.body (appears unrelated to the PR’s stated scope).

Copilot's findings

Tip

Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

  • Files reviewed: 2/2 changed files
  • Comments generated: 3

Comment on lines +664 to +665
"maxLength": 65000,
"minLength": 20
Comment thread .github/workflows/cgo.yml
Write-Host "✅ Microsoft Defender scan completed successfully for $binaryPath"

- name: Upload Defender scan logs
if: always() && runner.os == 'Windows'
Comment thread .github/workflows/cgo.yml
Comment on lines +1947 to +1950
with:
name: defender-scan-log-${{ github.run_id }}-${{ github.run_attempt }}
path: ${{ runner.temp }}/defender-scan-log.txt
retention-days: 7
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants